package com.spyx.exception;

import com.spyx.result.ResultCodeEnum;
import lombok.Data;

//如何使用自定义异常: throw  new SpyxException("操作失败。。。。。",301);
@Data
public class SpyxException extends  RuntimeException{

    private Integer code;//异常状态码

    public SpyxException(String message,Integer code){
        super(message);
        this.code=code;
    }

    public SpyxException(ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.code= resultCodeEnum.getCode();
    }
}
